<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
<tiles:insertDefinition name="layout">
	<tiles:putAttribute name="head">
		<style type="text/css">
</style>
		<script type="text/javascript">
			$(function() {
				$(".ajax").anchorAjax(function(a, data) {
					if (data.success) {
						$(a).find("i").toggleClass("icon-star-empty");
						$(a).find("i").toggleClass("icon-star");
					}
				});

				$(".date").datepicker({
					dateFormat : "yy-mm-dd"
				});
			});
		</script>

	</tiles:putAttribute>
	<tiles:putAttribute name="mainBody">
		<fieldset>
			<legend>剩余课时预警报表</legend>
		</fieldset>
		<form class="form-horizontal">
			<fieldset>
				<div class="control-group">
					<div class="control-label">结课时间</div>
					<div class="controls">
						<input type="text" class="date input-small" name="endTime" value='<s:date name="#endTime" format="yyyy-MM-dd"/>' />
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">是否在咨询跟单</label>
					<div class="controls">
						<div class="form-inline">
							<label class="checkbox">
								<input type="checkbox" name="consultStarred" value="true" <s:if test='"true" in #parameters.consultStarred'>checked="checked"</s:if> />是
							</label>
							<label class="checkbox">
								<input type="checkbox" name="consultStarred" value="false" <s:if test='"false" in #parameters.consultStarred'>checked="checked"</s:if> />否
							</label>
						</div>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">Consultant</label>
					<div class="controls">
						<div class="form-inline">
							<s:iterator value="#consultants" var="consultant">
								<label class="checkbox">
									<input type="checkbox" name="consultant" value="${consultant.id}" <s:if test='id in #parameters.consultant'>checked="checked"</s:if> />${consultant.name}
								</label>
							</s:iterator>
						</div>
					</div>
				</div>
			</fieldset>
			<div class="form-actions">
				<button type="submit" class="btn btn-primary">
					<i class="icon icon-white icon-search"></i>查询
				</button>
			</div>
		</form>
		<div>每页${signCourses.size}项，共 ${signCourses.totalElements} 项，当前${signCourses.number}/ ${signCourses.totalPages}页</div>
		<table class="table">
			<tr>
				<th>学员信息</th>
				<th>CC</th>
				<th>课程名称</th>
				<th>报名时间</th>
				<th>开课时间</th>
				<th>结课时间</th>
				<th>课次</th>
			</tr>
			<s:iterator value="#signCourses" var="signCourse">
				<tr>
					<td>
						<div>
							<s:url namespace="/consult" action="doUnStarredConsult" id="doUnStarredConsult">
								<s:param name="id" value="student.id" />
							</s:url>
							<s:url namespace="/consult" action="doStarredConsult" id="doStarredConsult">
								<s:param name="id" value="student.id" />
							</s:url>
							<s:if test="student.consultStarred">
								<a href="${doUnStarredConsult}" title="取消咨询关注该学员" class="ajax">
									<i class="icon-star"></i>
								</a>
							</s:if>
							<s:else>
								<a href="${doStarredConsult}" title="咨询关注该学员" class="ajax">
									<i class="icon-star-empty"></i>
								</a>
							</s:else>
							<strong> ${signCourse.student.name} </strong>
						</div>
						<div>学号:${signCourse.student.stuId}</div>
						<div>CC:${signCourse.student.consultor.name}</div>
						<div>Tutor:${signCourse.student.tutor.name}</div>
					</td>
					<td>${signCourse.student.consultor.name}</td>
					<td>${signCourse.course.name}</td>
					<td>${signCourse.signTime}</td>
					<td>${signCourse.beginTime}</td>
					<td>${signCourse.endTime}</td>
					<td>${signCourse.times}</td>
				</tr>
			</s:iterator>
		</table>
		<jsp:include page="/components/pagination/paginations.jsp"></jsp:include>
	</tiles:putAttribute>
</tiles:insertDefinition>